package com.qfmy.mapper.assistant;

import model.entity.assistant.AiVideo;
import model.query.VideoQuery;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.qfmy.mapper.assistant
 * @date 2025/5/19
 * @description 视频
 */
@Mapper
@SuppressWarnings("all")
public interface VideoMapper {

    /**
     * 插入
     * @param aiVideo
     */
    void insert(AiVideo aiVideo);

    /**
     * 根据时间获取视频数量
     * @param time
     * @param userId
     * @return
     */
    @Select("select count(*) from ai_video where create_time = #{time} and user_id = #{userId}")
    Integer getVideoCountByTime(String time, Long userId);

    /**
     * 根据获取说有的视频
     * @param userId
     * @return
     */
    List<AiVideo> getAllVideo(Long userId);

    /**
     * 根据id删除生成的视频
     * @param id
     */
    @Delete("delete from ai_video where id = #{id}")
    void deleteVideoById(Integer id);

    /**
     * 分页查询
     * @param query
     * @return
     */
    List<AiVideo> getVideoByPage(VideoQuery query);
}
